<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/vue-router.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<router-link to="/page1">第一个网页</router-link>
			<router-link to="/page2">第二个网页</router-link>
			<router-view></router-view>
		</div>
	</body>
</html>
<script type="text/javascript">
	var page1 = {
		template:'<h1>这是第一个网页</h1>'
	}
	
	var page2 = {
		template:`
				<div>
				<h1>这是第二个网页</h1>
				<hr/>
				<router-link to="/page2/star">star</router-link>
				<router-link to="/page2/moom">moom</router-link>
				<hr/>
				<router-view></router-view>
				</div>
				`
	}
	
	var star = {
		template :'<h2>这是第二个网页下的star</h2>'
	}
	
	var moom = {
		template : '<h2>这是第二个网页下的moom</h2>'
	}
	
	var router = new VueRouter({
		routes:[
			{
				path:'/page1',
				component:page1
			},
			{
				path:'/page2',
				component:page2,
				children:[
					{
						path:'/page2/star',
						component:star
					},
					{
						path:'/page2/moom',
						component:moom
					}
				]
			}
		]
	})
	
	var vm = new Vue({
		el:"#app",
		router
	})
</script>
